package com.zm.services.impl;

import com.zm.dao.IAccountDao;
import com.zm.domain.account;
import com.zm.services.IAcountServices;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import java.util.List;

@Component("AccountServicesImpl")
public class AccountServicesImpl  implements IAcountServices {
    @Resource(name = "accountDao")
    private IAccountDao accountDao;

    public void setAccountDao(IAccountDao accountDao) {
        this.accountDao = accountDao;
    }

    public void findAllAccount() {
        List<account> accoList=accountDao.findAllAccount();
        for (account ac:accoList
             ) {
            System.out.println(ac);
        }
    }

    public void saveAccount() {
        System.out.println("已经保存完毕!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
    }

    @PostConstruct
    public void initMethod(){
        System.out.println("对象被初始化");
    }
    @PreDestroy
    public void destoryMethod(){
        System.out.println("对象被销毁了");
    }
}
